﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace YAMN_Cinemas.Presentation
{
    public partial class test2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //ImageButton[] image = new ImageButton[25];
            //for (int i = 0; i < 5; i++)
            //{
            //    image[i] = new ImageButton();
            //    image[i].Height = 100;
            //    image[i].Width = 75;
            //    image[i].BorderWidth = 0;
            //    image[i].ImageUrl = "~/Images/104.jpg";
            //    image[i].Visible = true;
            //    form1.Controls.Add(image[i]);
            //    form1.Controls.Add(new LiteralControl("<br /><br />"));
            //}
            //TheatreEntities te = new TheatreEntities();
            //Movy movie = new Movy();
            //List<Movy> movies = new List<Movy>();
            //var q = from m in te.Movies
            //        select m;
            //movies = q.ToList();
            //Table tbl = new Table();
            //for (int row = 0; row < 5; row++)
            //{
            //    TableRow lrow = new TableRow();
            //    for (int i = 0; i < 3; i++)
            //    {
            //        TableCell lcell = new TableCell();
            //        ImageButton lbtn = new ImageButton();
            //        lbtn.ImageUrl = "~/Images/104.jpg";
            //        lcell.Controls.Add(lbtn);
            //        lrow.Cells.Add(lcell);
 
            //    }
            //    tbl.Rows.Add(lrow);
               
            //}
            if (!IsPostBack)
            {
                string[] filePaths = Directory.GetFiles(Server.MapPath("~/Images/"));
                List<ListItem> files = new List<ListItem>();
                foreach (string filePath in filePaths)
                {
                    string fileName = Path.GetFileName(filePath);
                    files.Add(new ListItem(fileName, "~/Images/" + fileName));
                }
                GridView1.DataSource = files;
                GridView1.DataBind();
            }

           
            

        }
    }
}